<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>获取地址栏参数</title>
	<script type="text/javascript">
		
		// 获取?后面的参数
		window.onload = function(){

			var Data = window.location.search;
			var hash = window.location.hash;
			var oSpan = document.getElementById('span01')

			var arr = Data.split('=');
			alert(arr);

			var name = arr[1];

			oSpan.innerHTML = name;

			// 获取#后面的参数
			alert(hash);
		}

	</script>
</head>
<body>
	<div id="div1">欢迎<span id="span01"></span>访问我的主页!</div>
</body>
</html>